package com.flash.dailyreport.service;

import com.flash.dailyreport.entity.NewsEntity;
import com.flash.dailyreport.service.handler.news.SinaNewsHandler;
import com.flash.dailyreport.service.handler.news.XimalayaNewsHandler;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author sunyiming
 * @date 2018/8/17
 */
@Service
public class NewsService {

    public Map<String, List<NewsEntity>> getNewsFrom(String webname) {
        switch (webname) {
            case "sina":
                return new SinaNewsHandler().getMainNews();
            case "ximalaya":
                return new XimalayaNewsHandler().getMainNews();

            default:
                return new HashMap<>();
        }
    }

}
